﻿using System;
using System.Text.RegularExpressions;

namespace SlickGridNet.Utils
{
	public static class StringUtils
	{
		static Regex jsIndentifierRe = new Regex(@"^[a-zA-Z_]{1}[a-zA-Z\d_]*$",RegexOptions.Compiled|RegexOptions.Singleline);

		/// <summary>
		/// Check if specified string conform JavaScript identifier rule.
		/// </summary>
		/// <param name="value">String value to check.</param>
		/// <returns><c>true</c> if value conform, else <c>false</c> returned.</returns>
		public static bool IsIdentifier(string value)
		{
			return jsIndentifierRe.IsMatch(value);
		}
	}
}